Sine cosine optimization algorithm combined with balloon effect for adaptive position control of a cart forced by an armature-controlled DC motor

For a car that is propelled by an armature-controlled DC motor This study proposes an adjustable linear positioning control. In this paper, to optimize the parameters of the car’s position controller the sine cosine optimization algorithm (SCA) is utilized, with support from the Balloon effect (BE), The BE is incorporated to enhance the responsiveness of the traditional sine cosine optimization algorithm when faced with external disturbances and variations in system parameters. In the proposed approach, the determined value of the open loop transfer function of the motor and the updated values of the controller gains serve as the basis for the modified sine cosine algorithm’s objective function (OF). Under the influence of changes in motor parameters and step load disturbances, the system using the suggested controller is evaluated. Results from simulations and experiments show that the proposed adaptive controller, which implements the modified sine cosine algorithm, enhances the system’s overall performance in the presence of load disturbances and parameter uncertainties.


Literature review
Although the DC motor has many benefits and uses in a variety of sectors, it also has certain disadvantages, including limited speed control, brushes and commutation, big size, electromagnetic interference, and expensive cost [1].The DC motor is used in a variety of commercial applications, including those for robots, electric vehicles, the aerospace industry, industrial automation, energy production, medical sector and agriculture [2].To control the DC motor, several controllers are proposed, different controllers have been showed in literature [3][4][5][6].Amongst them, the (PID) controller is frequently used in industry Due to its efficiency and simplicity, improving both steady-state and transient performance.PID controllers have been used in many applications [7][8][9], including the DC motors control.However, it was necessary to develop online tuning techniques for the PID controller.In recent literature, there has been a surge in the adoption of optimization methodologies to fine-tune control parameters due to their effectiveness in mitigating uncertainties and disturbances [10][11][12][13][14][15].Various optimization techniques have been explored in research papers, including a modified inverse neural controller [10], the Crow Search Algorithm [11], bee-colony optimization [12], particle swarm optimization (PSO) [13], Henry gas solubility optimization [14], and the grey wolf optimizer [15].Furthermore, optimization techniques have been implemented for offline tuning of classic PI-LFCs as evidenced by studies such as [16,17].These endeavors highlight the wide range of optimization approaches being employed to enhance controller performance and address control system challenges.since fixed parameters controllers created using nominal operating points are not suited for real-time operating situations.[18].Several optimization algorithms, such as atom search optimization (ASO) [19], Zeigler-Nich reinforcement learning [20], and enhanced Bacterial Foraging Optimization (BFO) [21,22], have been proposed to compute finest parameters for the PID controller, Reinforcement learning: In this approach, the controller gains are adjusted based on the performance feedback obtained through trial and error.The controller learns from its own actions and continuously improves its performance.One of the popular reinforcements learning algorithms used for PID tuning is the Q-learning algorithm [23].Additionally, techniques like fuzzy logic [24], genetic algorithms [25], and neural networks [26] have also been used for online tuning of PID parameters in various applications Model-based online tuning Using a model of the process dynamics, the controller gains can be adjusted in real time based on the current process state and desired performance criteria.This can be achieved using techniques like adaptive control or model predictive control (MPC) [27] a nature-inspired optimization technique that mimics the behavior of the sine and cosine functions called Sine Cosine algorithm (SCO) to solve optimization problems.This algorithm is widely used in various fields [28].It has been successfully applied in Optimal power flow in electrical power systems [29], Parameter tuning in machine learning (ELDPs) [18], Routing optimization in wireless sensor networks [30], Energy-efficient scheduling in cloud computing [31] and Optimization of machining parameters.In the field of electrical DC motors.Furthermore, in order to enhance the effectiveness of optimization algorithms for dealing with system problems including load disruption and parameter uncertainties, a modification known as the balloon effect (BE) has been proposed [32].

Problem analysis
The adaptive control problem is solved using several optimization approaches in different ways.These methods may be used to modify the settings of neural network or fuzzy controllers [26], where the controlled variable's error value serves as the basis for the objective function.There have been several efforts to directly optimize the adaptive controller's parameters using optimization techniques.[27].In these attempts, the objective function is constructed using time response characteristics such as overshoot, rise time, and settling time However, these methods have a drawback as they are based on nominal values of system parameters, thus making them less effective for time variant systems.To address this issue, a modification called BE has been proposed [24,25].The objective function of the BE modification takes into account the new values of parameter variations and other system modifications.This allows standard optimization algorithms to be applied in adjusting control systems in real-time and industrial applications, such as load frequency control and motor control.population size; I, Number of iterations; X(S), the position of the car; V m (S), motor voltage; I m , motor current; R m , electric resistance of the motor; L m , Inductance of the motor; E emf , back electromotive force voltage; K t , Motor torque constant; M, The total mass of the car system; F ai , armature rotational inertial force; F C , Car driving force produced by the motor; B eq , equivalent viscous damping coefficient; ζ g , efficiency of gearbox; r mp , motor pinion radius; K g , planetary gearbox ratio; T ai , armature inertial torque; J m , rotor moment of inertia; K t , motor torque constant; ζ m , Efficiency of the motor; V m , voltage motor; ΔPg, The variation in the governor's output; ΔPd, Change in diesel power; Δf, Frequency deviation; ΔPL, Load deviation; ΔPc, additional control action; M, Equivalent inertia constant; D, Equivalent damping coefficient; R, Speed drop characteristic; Tg, Time constant of the governor; Td, Time constant of the Turbin.

Contribution
The main contributions of this work can be summarized as: • Proposing an adaptive position control method that utilizes sine cosine optimization technique with the support of BE for an industrial application represented by a cart forced by armature controlled DC motor and the proposed controller succeed to increase the precision of car desired position tracking.
• both digital/experimental tests assured how strong is the proposed adaptive control based SCO+BE in industrial applications.
• the suggested adaptive controller using SCO+BE has been used to make online tuning of load frequency controller in an isolated MGs and it proved efficiency in LFC issue in case of system difficulties such as load disturbance • Demonstrating the effective problem-solving capabilities of the suggested control method by comparing the suggested optimization algorithm with other optimization techniques.
• To the best of the writers' knowledge, this is the first time of utilizing SCO+BE for tunning the controller gains of the studded systems.
This manuscript is organized as the following; Section 2 discusses the sine cosine algorithm (Mathematical representation of classical SCO is presented in subsection 2.1 and Sine cosine algorithm combined with Balloon Effect (SCO+BE) is discussed in subsection 2.2) Section 3 designates the SCO+BE for position control of armature controlled DC motor.The SCO+BE for LFC of isolated microgrid is presented in Section 4. Section 5 discusses the conclusion.Section 6 suggests the future work.

Mathematical representation of classical SCO
Researchers and practitioners in the field of optimization algorithms are continually looking for efficient and effective methods to address challenging optimization problems.Sine Cosine Optimization (SCO) is one such method that has received a lot of interest.By mimicking the natural oscillations seen in sine and cosine functions, which are mathematical ideas, SCO offers a novel method of optimization.Initially, a population-based metaheuristic optimization method was suggested for the SCO algorithm.It takes inspiration from sine and cosine waves, whose smooth motion displays periodic oscillations with predictable behavior.By simulating this natural occurrence, SCO hopes to quickly explore complicated solution spaces by striking a balance between exploration and exploitation during the search process [28].
The main idea behind SCO is that it can efficiently explore the search area and produce a variety of solutions.A population of potential solutions, each represented by a set of variables, is kept in memory by the algorithm.The direction and size of the movement for each unique solution are determined by the sine and cosine functions, which are used to update these variables [20].Fig 1 represents Diagram of SCA search mode.SCO promotes exploration of unexplored areas while gradually convergent towards desirable portions of the solution space by combining these oscillatory dynamics with randomization.To guarantee the quality and diversity of the population, SCO uses a variety of components.These include adaptive parameters that regulate the trade-off between exploration and exploitation, individual best and global best solutions, and random initialization.Through iterative updates and interactions among the individuals in the population, SCO strives to find optimal or near-optimal solutions for a given optimization problem.
SCO is distinguished by its simplicity and ease of use in implementation.The method is known for its competitive performance across a variety of optimization issues and requires minimum parameter adjustment.Engineering design, image processing, banking, and machine learning are just a few of the areas in which SCO has been effectively used, exhibiting its adaptability and efficiency.
the SCO offers a promising approach to solving complex optimization problems.By drawing inspiration from the oscillatory behavior of sine and cosine functions, SCO strikes a balance between exploration and exploitation, enabling efficient search and convergence.With its simplicity, versatility, and competitive performance, SCO has emerged as a valuable optimization tool for researchers and practitioners alike [29,30].
(SCO) algorithm is a metaheuristic optimization algorithm that is used to solve optimization problems by iteratively adjusting a set of candidate solutions to find the optimal solution The first step in SCO is the initialization by Defining the problem's search space boundaries and the number of iterations and initialize the population of candidate solutions with random values within the search space Then it calculates the Objective Function(of) for every solution and update each candidate solution using Eq (1) where (r) is a random number between (0 and 1), then it Apply sine and cosine transformations to further update the candidate solutions for each variable in the solution, by using the Eq (2) and calculate the fitness of each updated solution where A, B, and C are random parameters, and k is the current iteration number, then the algorithm Update the best solution by Comparing the fitness of the updated solutions with the fitness of the best solution found so far and if an updated solution has a better fitness, update the best solution finally the algorithm stops by reaching the maximum number of iterations or satisfies the convergence criterion.The following information provides some notes about the Sine Cosine Optimization (SCO) algorithm: • In SCO, a matrix with a number of items equal to the population size times the number of design variables represents the initial population.The best and worst values may be calculated using new solution values due to this matrix.
• for the same design variable in SCO, the initial values should be chosen close together to minimize sudden switches at the beginning of the optimization process.
• using a large population size and number of iterations can cause the SCO algorithm to run slowly, leading to poor real-time characteristics.To overcome this issue, it is recommended to set limitations on the number of iterations that may not necessarily result in the best solution but can yield better results than the standard algorithm.
• SCO can provide better and faster solutions by saving the ideal solution for next iterations.
SCO is sometimes used in the issue of adaptive control to optimize the control inputs of a robotic manipulator.The algorithm was applied to tune the controller parameters based on the error between the desired and actual positions of the robot.This helped in improving the control performance and ensuring precise and smooth trajectory tracking.[26], and other times in controlling the unmanned aerial vehicles (UAVs), the SCO algorithm was utilized to optimize the UAV's flight path and control parameters.By minimizing the cost function associated with trajectory tracking and energy consumption, the algorithm provided an efficient solution for adaptive control of UAVs in dynamic and uncertain environments.[27]  The classical SCO approach lacks the ability to adapt to variable disturbances or changes in system parameters in real-time.This limitation is a flaw in the traditional SCO's application to the adaptive control problem.

Sine cosine algorithm combined with Balloon Effect (SCO+BE)
A feature called BE has been incorporated into the SCO algorithm in order to improve its efficiency in handling external disturbances or changes in plant parameters.This modified SCO

The relation between G i (S) and G i−1 (S)
At iteration (i) the impact of disturbance and changes in system parameters is represented by AL i .The shape of G i (S) changes depending on the value of AL i , similar to how a balloon shrinks and stretches affected by air pressure (as shown in Fig 2).
The relationship between G i (S) and G O (S) stated as: 4. The relation between G i (S) and G O (S) can be expressed using Eq (5).
AL n Þ, which illustrates the presence of system problems.As a result, the SCO' OF will change based on the values of system disruption and uncertainty levels, ultimately improving the performance of SCO.Fig 4 illustrates the use of SCO + BE.Briefly, BE makes the objective function responsive to system variations at any given moment, increasing the efficiency of adaptive control optimized by SCO + BE.This makes it suitable for applications for industry such as load frequency control, thermal controland machine control.The flowchart of SCO with BE is shown in Fig 5.
a step by step of the algorithm for the studded system starts with • The code starts by accepting four input arguments: u1, u2, u3, u4.
• Based on the inputs u1 and u2, the transfer function G(s) is computed and stored in the variable G.
• The value of parameter al is determined using u3, G, and u4.
• Initialization of various variables essential for the optimization process takes place.This includes setting the lower bound (lb) and upper bound (ub), as well as defining optimization parameters (beta, delta, max_iter) and population variables (x, s, fitness).
• The fitness of each population member is evaluated using an Objective Function • The population member with the highest fitness value is identified as the best individual.
• The optimization process commences with a loop that runs for max_iter iterations.
• During each iteration, the position and scale of each population member are updated using random calculations.
• The position is perturbed and adjusted to be within the limits specified by lb and ub.
• The fitness of each population member is evaluated once again.
• If a fitter member is found, the best population member is updated accordingly.
• After the loop concludes, the optimized values of kp and kv are extracted from the best member and stored in the variables kp and kv, respectively.
• Finally, the function returns the values of kp and kv as the output.

Dynamic model of the studied DC motor
In this study, the focus is on a cart system that is propelled by a DC motor controlled by an armature.through a track mechanism with a pinion, powered by a DC motor connected to a planetary gearbox [31,32].The car's system's behavior may be represented by an open loop transfer function, which is as follows: with reference to the Newton's second law: to provide the armature inertial torque by: By utilizing Newton's second law, one can determine that: The mechanical arrangement of the car's rack and pinion system can be calculated as: The motor's driving force F C can be calculated using: The DC motor's torque can be stated as follows: Furthermore, the angular velocity of the motor may be written as: Fig 7 depicts the armature circuit of a typical DC motor.This electrical circuit's use of Kirchhoff's voltage law is illustrated as: By ignoring the motor's inductance, we get Finally, the motor's (TF) can be determined as: The block diagram for the under-study armature-controlled DC motor is shown in Fig 8, which gives detailed information.Table 1 [31] contains thorough information on the system's elements.Table 2 also shows the maximum values related to the electrical motor.parameter K v0 , which is the nominal value of K v , can be illustrated as follows:

Controlling of the studded system using SCO-based adaptive position control
In order to attain system characteristics of 10% overshoot and a rise time of 0.15 sec, these specific values of K p0 and K v0 were used.
The objective of SCO optimization is to optimize the gains Kp and Kv, of the PV controller.Fig 10 illustrates the implementation of a DC motor's adaptive position controller using the classical SCO optimization method.To optimize the SCO objective function (OF), it is necessary to calculate the closed loop transfer function of the system using Eq (16) and taking into account the nominal data provided in Table 1 then Additionally, as illustrated in Fig 10 the feedback transfer function may be stated as: By observing Eq (18), we can observe that during any iterations, the variables ω ni ,η i ,T ri ,T si , M pi , and J min are solely dependent on the modified gain values of the PV controller, K pi and K vi ,.   which shows the position control system using the proposed SCO with BE. Where ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi The values of ω ni and η i are used to calculate the parameters M pi ,T ri and T si for the closedloop system of second order.It is clear that the minimum objective function in J min SCO is influenced by the values of K pi , K vi , and the term ð Q l n¼1 AL n Þ, which represents system disturbance and parameter variations.How the problem and algorithm interact is demonstrated in the following scenario: During each iteration, while the computer executing the code of SCO and BE it receives the plant's input U i and the output X i .The values of these signals will be used to compute G i (S) using Eq (2), and the previously stored value of G i−1 (s) will be used to determine the value of AL i .The value of ( Q l n¼1 AL n ) will be determined using this value and its previous cumulative values that were previously saved.Meanwhile, the loops of SCO algorithm will generate potential values of K pi , K vi which will be used with ð Q l n¼1 AL n Þ to calculate the parameters of the time response M pi ,T ri and T si .These parameters will be used to determine the value of the objective function J min i , which eventually determines the ideal and final values of K pi , K vi .These values will be provided to the PV controller's Simulink program, which will produce the control signals and transmit them to the physical process via a Data Acquisition card.The suggested adaptive control scheme's effectiveness is influenced by the computer's technical parameters, including its RAM, cache memory, and CPU speed.

Simulation results for proposed controller of DC motor application
The Simulink package of MATLAB used as a simulation environment for the DC motor (with parameters listed in Table 1) system with the proposed control algorithm, in addition, the parameters of the suggested SCO is illustrated in Table 3.
The modified SCO approach includes the following variables.The chosen object function has been utilized.
As shown in Fig 11, the physical disturbance has been replaced with an equivalent voltage using the sum point movement option to make it measurable.The system under analysis has been tested for two scenarios: a sudden change in desired input and a sudden load disturbance.To observe the impact on the proposed system, an equivalent load disturbance has been introduced from t = 3 seconds to t = 5 seconds.The value of the load disturbance is 0.95 volts, as shown in Fig 12 .Furthermore, the desired motor position signal starts at 1.5 seconds with a magnitude of 15 mm and ends at 6 seconds.with the normal SCO.The PV controller tuned by the proposed SCO + BE also improves the overshoot during step disturbance.Also Fig 13 demonstrates that the suggested PV controller tuned by normal SCO or modified SCO + BE successfully handles load disturbance.Furthermore, the performance with the modified SCO technique is superior to that of the normal SCO.also, comparison has been made between SCO+BE and Jaya+BE (presented in [32]) in Fig 14 leads to an improvement of the overshoot during step disturbance of the proposed SCO + BE than jaya algorithm.Detailed parameters can be found in Table 4. From Table 4, it can be observed that the proposed SCO + BE yields the best overshoot, rise time, and settling time compared to other controllers.Both Figs 13 and 14 demonstrate that the suggested PV controller tuned by modified SCO + BE successfully handles load disturbance.Furthermore, the performance with the SCO +BE technique is superior to that of the normal SCO and jaya algorithm.

Experimental results for proposed controller of DC motor application
The experimental implementation of the suggested car powered by a DC motor is seen in Fig 15 .QPIDe data acquisition card and QuanserVoltPAQ were used to communicate between It is evident that the system response achieved using the modified SCO+BE is smooth and stable, while the response obtained using the standard SCO algorithm is unfavorable in the initial three seconds, characterized by high ripples.according to the experimental data, the system using the PV controller tuned by the suggested SCO+BE technique is clearly more resilient and robust than the system using the controller optimized by the traditional SCO method.Furthermore, a comparison between SCO and SCO+BE is conducted at selected time instances (t = 3 sec.and t = 5.5 sec.), and the obtained data is recorded in Table 5 using the program code.The data presented in Table 5 confirms that during critical moments such as the introduction and removal of step load disturbance, the system with the controller tuned by SCO+BE exhibits favorable values for T r , T s , M p and ISE compared to the system with the controller tuned by standard SCO.
To support the past simulation and experimental extracts, some statistical analysis have been done.Performance metrics, including mean square error (MSE), maximum error (Max  E), minimum error (Min E), and standard deviation (STD E), were selected to assess the accuracy of position control.Each method underwent three trials, and the MSE, Max E, Min E, and STD E values were computed for each trial.The resulting metrics for the trials are as shown in Table 6.
Regarding the analysis of position control accuracy for the armature-controlled DC motor, the mean square error (MSE) values for three different methods, namely SCO+BE, normal SCO, and the conventional controller were found to be 0.0126, 0.024, and 0.033, respectively.

Dynamic Model of an isolated microgrid
Applying the suggested control method to other application is an effective method to evaluate it.A chosen application is an isolated microgrid power system.Fig 19 illustrates the power flow graph of the proposed microgrid while Fig 20 shows the block diagram of a chosen micro-grid power system.Eqs 20-22 can be used to characterize the dynamic model of the suggested micro-grid power system.The supply error (ΔPd-ΔPL) and frequency variation (Δf) have a dynamic connection that may be represented as the total load-generator;: The dynamic of the diesel generator may be written as: The dynamic of the governor may be written as: The parameters of the studied microgrid system is illustrated in Table 7.
This is the OF of the SCO-based BE identifier.
This means that the OF (J) is a function of AL i and k i to address the system challenges.

Simulation results of microgrid LFC based SCO+BE
To evaluate the effectiveness of the proposed adaptive control algorithm, system with SCO+BE has been compared with that one with only SCO with parameters shown in Table 8, Jaya(with detailed listed in [32]) and classical I in case of step load change from 0 to 0.025 pu at t = 10,

Conclusion
This paper proposes an innovative adaptive controller that utilizes a modified SCO algorithm to individually adjust the gains of traditional controller parameters.In order to enhance the performance of the standard SCO a new modification method called the "Balloon Effect (BE)" is introduced.The BE approach incorporates both the values of the tuned gain parameters and the system changes, represented by the parameter ALi, into the objective function of the SCO algorithm This modification increases the algorithm's sensitivity to load disturbances and uncertainties in the system parameters, resulting in improved system characteristics.
The proposed approach has been used to optimize a PV controller's gains for controlling the linear position of a cart powered by a DC motor and to make online tuning of load frequency controller in isolated microgrid.By combining BE with SCO, Improvement has been made to the control method's sensitivity to load disturbance and system parameter uncertainty for both systems.Additionally, incorporating BE into the SCO algorithm has led to improvements in the system's general characteristics, including rise time, settling time, and over shoot.The proposed adaptive controller using SCO+BE has been evaluated against external step disturbances and has demonstrated excellent and distinguished results.Comparisons between the system with modified SCO, normal SCO and jaya optimization algorithm under external disturbances and system parameter changes have been made, with simulation and experimental results supporting the superiority of the proposed SCO+BE system in all study cases.

Future works
• Exploring the application of the proposed approach to diverse optimization techniques, including whale Search, Bat optimization algorithm, and ADAM optimization.
• Additionally, investigating the potential improvement of the proposed control algorithm in other industrial applications

Fig 1 .
Fig 1. Diagram of SCA search mode.https://doi.org/10.1371/journal.pone.0300645.g001 Fig 2 shows an example of SCO being applied directly to optimize controller gains.The present case shows that, the rising time (Tr), maximum overshoot (Mp) and settling time (Ts) of the closed-loop system serve as the foundation for the objective function of SCO.These parameters are determined by the damping ratio (η) and natural frequency (ωn), which are elements of the theoretical open loop transfer function Go(S).

Fig 3 .Fig 4 .
Fig 3. Idea of SCO with BE. https://doi.org/10.1371/journal.pone.0300645.g003 Fig 6  provides an illustration of this system.The cart itself is made of aluminum and is able to move along a shaft with a linear bearing.The movement of the cart is achieved

3. 2 . 1
Standard adaptive PV controller based on SCO.The design of the PV controller is seen in Fig 9.The model of the previously mentioned armature-controlled DC motor is represented by G(S) in this diagram.The parameter K p0 , which is the nominal value of K p , and the

Fig 19 .Fig 20 .
Fig 19.Power flow chart of the studied microgrid.https://doi.org/10.1371/journal.pone.0300645.g019 Fig 22 illustrate the frequency responses of the four controllers at this case, while Fig 23 shows the diesel power deviations at the same situation.From Figs 22 and 23 its clear that system with SCO+BE is superior from the time response viewpoint.

Table 1 . Studded Values of system parameters.
The system closed loop transfer function can be calculated during any iteration using Eqs (5) and (16), and the structure depicted in Fig 8, as demonstrated in Fig 10 https://doi.org/10.1371/journal.pone.0300645.t0013.2.2 Modified adaptive PV controller based on SCO+BE.

Table 6 . Statistical analysis for I, SCO and SCO+BE.
https://doi.org/10.1371/journal.pone.0300645.t006 , R o, and M o are the nominal values of D, R, and M, respectively